home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / commands / make / READ_ME < prev    next >
Text File  |  1990-07-15  |  18KB  |  487 lines

  1. This READ_ME file is the third major release of 'make'.  A discussion of
  2. its history is contained below.
  3.  
  4.  
  5. ========================== Caveats =================================
  6.  
  7. CAVEATS for 'make'                                      by RAL (23.8.89)
  8.  
  9.  
  10.  
  11. a) undefined macros will expand to a null string !
  12.  
  13. b) $<,$* are only defined for implicit rules !
  14.  
  15.    If you use them within an explicit rule they will be not defined and will
  16.    according to a) expand to a null string without an error message.
  17.    This is due to the original definition and the fact that they cannot be
  18.    defined in a unique way for explicit rules:
  19.  
  20.     "$< is the name of the related file that caused the action" [1]
  21.  
  22.        within explicit rules there may be several dependencies; and within
  23.          foo.o : foo.c foo.h
  24.                  commandline
  25.        foo.h may be the file that causes the action where you may expect
  26.        $< set to foo.c .
  27.  
  28.     "$* is the prefix shared by the current and the dependent file names"
  29.  
  30.        within explicit rules there may be several dependencies with no common
  31.        prefix like in the following example:
  32.          foo.o : foo.c include.h
  33.                  commandline
  34.  
  35. c) Which implicit rules is applied ? According to Feldman [1] :
  36.  
  37.    "If there are two paths connecting a pair of suffixes, the longer one is
  38.     used only if the intermediate file exists or is named in the description"
  39.  
  40.    With the consequence that:
  41.    -  if you want .l.c .c.o to be applied on a source foo.l either foo.c must
  42.       exist already or you must add
  43.          foo.c :
  44.       to your makefile
  45.    -  if you want foo.o to be made out of foo.l you must either define
  46.       several implicit rules and name the files explicitly like in the
  47.       example above, or define an additional implicit rule .l.o
  48.  
  49. d) Feldman [1] forgot to define how implicit rules should be applied on a
  50.    target with a given list of dependencies but no explicit command line.
  51.  
  52.    Besides the problems mentioned in b) an additional problem occurs:
  53.    Given the makefile:
  54.  
  55.       foo.o : foo.c
  56.  
  57.    and  .SUFFIXES : .s .c   and implicit rules .s.o, .c.o
  58.    and existing files  foo.c,foo.s
  59.    it's not defined which rule should be applied. With the standard algorithem
  60.    .s.o would be selected, what's a little bit strange.
  61.  
  62.    Therefore I did implement the following definitions:
  63.  
  64.      Implicit rules will be choosen according to the sequence of the .SUFFIXES
  65.      dependencies. But if explicit dependencies exist for the target implicit
  66.      rules connecting the target with an explicit dependency will be choosen.
  67.  
  68.      "$< is the name of the related file (dependency) that is generated by
  69.          substituting the suffix of the target file by the one given in
  70.          the implicit rule"
  71.      "$* is the prefix shared by the target name and $<"
  72.  
  73.    This should result in what everyone aspects make to do.
  74.  
  75.  
  76. [1] S.I. Feldman :  Make - A Program for Maintaing Computer Programs
  77.  
  78.  
  79.  
  80.  
  81. ========================== Readme1 =================================
  82.  
  83. Following is a repost of the public domain 'make' that I posted
  84. to net.sources a couple of months ago.  I have fixed a few bugs, and
  85. added some more features, and the resulting changes amounted to
  86. about as much text as the whole program (hence the repost).
  87.  
  88. For those that missed the net.sources posting, this is a public domain
  89. re-implementation of the UNIX make program.  There is no manual included;
  90. for documentation, refer to a UNIX manual, or the source.
  91.  
  92. Here is a list of the changes made:
  93.  
  94. i)    If '-' (ignore) or '@' (silent) where used at the start
  95.     of a command, their effect was not turned off for the following
  96.     commands.
  97. ii)    A special target (.SUFFIXES, .PRECIOUS) or a rule (.c.o, .a.o),
  98.     if first in the file would be taken as the default target.
  99.     This resulted in error messages like "Don't know how to
  100.     make .c", because things like .SUFFIXES were being made.
  101.     This was further complicated by ---
  102. iii)    Special target lines with no dependents (ie. .SUFFIXES:\n)
  103.     were not clearing out the existing dependents like
  104.     they should.
  105. iv)    Default rules could not be redefined because of the error
  106.     checking for commands being defined twice.  Now you are
  107.     allowed to define a target beinging with '.', having
  108.     no dependents with commands.
  109. v)    The -q option didn't do the time comparison correctly,
  110.     or clear the variable used to keep track of this.  Thus
  111.     it didn't work very well.
  112. vi)    The syntax ${..} for macro's supported by UNIX make was
  113.     not supported.
  114. vii)    There wuz a couple of spelling errors.
  115. viii)    When make checked for implicit rules on targets without
  116.     a suffix, there were problems.  (Note: The ~ feature of
  117.     UNIX make wasn't and still isn't supported)
  118. ix)    The -n option did not print @ lines like it was supposed to.
  119. x)    :: added.  (See UNIX manual)
  120. xi)    $? added.  (see UNIX manual)
  121.  
  122.  
  123.  
  124. ========================== Readme2 =================================
  125.  
  126. Problems fixed:
  127.   - various calls of functions with incorrect arguments (0 instead of NULL
  128.     pointers) in rules.c  [2] (In [1] = [3] there are still some casts
  129.     missing) 
  130.  
  131.   - passing of a NULL pointer to strcmp in main.c, which the ST didn't like
  132.     at all  [1] ([2] complex bug fix; [3] is missing this bug fix !!)
  133.     
  134.   - implicit rules didn't work if an explicit rule was given for the
  135.     dependency file but no old version of the dependency file existed.
  136.     Example:
  137.  
  138.       makefile:
  139.         #  make bug1 ---  scan.c,scan2.c  must not exist !!
  140.         flex : scan.o scan2.o
  141.             cc scan.o scan2.o -o flex
  142.         
  143.         scan.o : scan.c
  144.         
  145.         scan.c : scan.l
  146.             flex -ist scan.l > scan.c
  147.         
  148.         scan2.c : scan.l
  149.             flex -ist scan.l > scan2.c
  150.        
  151.       output:  
  152.         flex -ist scan.l > scan.c
  153.         make: Don't know how to make scan2.o
  154.  
  155.       Even though the implicit rule .c.o exists make ignores the explicit
  156.       rule for scan2.c and even with an empty explicit rule for scan.o
  157.       make forgets to compile the generated scan.c !
  158.       
  159.     Both errors are caused by the same bug which I have fixed in rules.c
  160.     with inserting the "op->n_line" stuff.
  161.     
  162.   - "$*" macros within recursive implicit rules have been expanded to
  163.     wrong values
  164.  
  165.       makefile:
  166.         #  make bug2 (recursive implicit rules with $* )
  167.         .c.o :
  168.             cc -c $*.c
  169.         
  170.         flex : nfa.o sym.o
  171.             cc  nfa.o sym.o -o flex
  172.         
  173.         nfa.c : sym.o
  174.             mv nfa.c2 nfa.c
  175.         
  176.       output:
  177.         cc -c sym.c
  178.         mv nfa.c2 nfa.c
  179.         cc -c sym.c
  180.         cc  nfa.o sym.o -o flex
  181.  
  182.       Within the second compile command $* gets expanded again to "sym"
  183.       instead of "nfa" ! (This example looks artificial -- there is a
  184.       more realistic one below)
  185.       
  186.     The $* macro had been set before the dependency files had been made,
  187.     which could redefine the macro again. I fixed the bug in rules.c and 
  188.     make.c (baseline stuff)
  189.  
  190.   - "$<" macros within recursive implicit rules have been expanded to
  191.     wrong values
  192.     
  193.       makefile
  194.         #  make bug3 (recursive implicit rules with $< )
  195.         .c.o :
  196.             cc -c $<
  197.         
  198.         flex : nfa.o sym.o
  199.             cc  nfa.o sym.o -o flex
  200.         
  201.         nfa.c : sym.o
  202.             mv nfa.c2 nfa.c
  203.         
  204.       output:
  205.         cc -c sym.c
  206.         mv nfa.c2 nfa.c
  207.         cc -c sym.c
  208.         cc  nfa.o sym.o -o flex
  209.    
  210.       Within the second compile command $< gets expanded again to "sym"
  211.       instead of "nfa" ! (This example looks artificial -- there is a
  212.       more realistic one below)
  213.       
  214.     The $< macro had been set before the dependency files had been made,
  215.     which could redefine the macro again. I fixed the bug in rules.c and 
  216.     make.c (inputline stuff)
  217.  
  218.  
  219.     More realistic makefile to demonstrate the $* and $< bugs:
  220.       makefile:
  221.         #  parse.y, scan.c should exist, scan.o depends on parse.h (y.tab.h)
  222.         #  which will be generated together with parse.c
  223.         flex : scan.o
  224.             cc scan.o -o flex
  225.         
  226.         scan.o : parse.c
  227.       
  228.       output:
  229.         yacc  parse.y
  230.         mv y.tab.c parse.c
  231.         cc -O -c parse.y
  232.         cc scan.o -o flex
  233.         
  234.       I fear our compiler doesn't know how to